﻿#ifndef _CCLIENT_LISTENER_MODULE_H_
#define _CCLIENT_LISTENER_MODULE_H_

#include "CModule.h"
#include "CMsg.h"

#include <winsock2.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _cclientlistener_module_ {
	CModule parent;

	//attribute
	CModule* msg_executer;
	SOCKET	mSocket;
	HANDLE	mEvent;
	char server_ip[20];
	unsigned short port;

	//action
	int(*connect_server)(struct _cclientlistener_module_*);
	int(*send_msg_to_server)(struct _cclientlistener_module_*, CMsg*);
} CClientListenerModule;

int construct_client_listener(CClientListenerModule* thes, const char* module_name, const char* server_ip, unsigned short port, CModule* msg_executer);

#ifdef __cplusplus
}
#endif
#endif
